<template>
  <div>
    <div class="container radiusBottom">
      <div class="images">
        <div class="img">
          <img :src="styleUrls[dataJson.type][dataJson.stylesType]" />
        </div>
        <div class="buttonSetStyle" @click="alertTag">修改样式</div>
      </div>
    </div>
    <div class="container">
      <div class="line">
        <div class="left ">标题名称</div>
        <div class="inputContent">
          <el-input
            v-model="dataJson.innertext"
            class="inputs"
            type="text"
            maxlength="5"
            show-word-limit
            @change="inputhandle"
          />
        </div>
      </div>
      <div class="line">
        <div class="left ">标题颜色</div>
        <div class="colorOption">
          <div class="divs">
            {{ dataJson.color }}
          </div>

          <el-color-picker
            v-model="dataJson.color"
            show-alpha
            size="medium"
            class="colorPicker"
          ></el-color-picker>
        </div>
      </div>
      <div class="line">
        <div class="left ">背景颜色</div>
        <div class="colorOption">
          <div class="divs">
            {{ dataJson.bgcolor }}
          </div>

          <el-color-picker
            v-model="dataJson.bgcolor"
            show-alpha
            size="medium"
            class="colorPicker"
          ></el-color-picker>
        </div>
      </div>

      <div
        v-if="dataJson.stylesType == 1 || dataJson.stylesType == 2"
        class="line clearfix"
      >
        <span class="text">更多链接</span>
        <el-tooltip
          class="item"
          effect="dark"
          :content="dataJson.textUrlName"
          placement="bottom"
        >
          <button
            class="buttonFunction m_l_10 tooltips"
            @click="chooseLink(dataJson.stylesType)"
          >
            {{ dataJson.jump_name }}
          </button>
        </el-tooltip>
      </div>
    </div>
  </div>
</template>

<script>
import { styleUrls } from "../../data";
export default {
  props: {
    dataJson: {
      type: Object,
      default: () => {}
    }
  },
  data() {
    return {
      styleUrls
    };
  },
  methods: {
    chooseLink(index) {
      this.$emit("chooseLink", index);
    },
    inputhandle() {
      let num = this.dataJson.innertext.length;
      if (num === 0) this.dataJson.innertext = "请输入文字";
    },
    alertTag() {
      this.$emit("alertTag", true, this.dataJson.stylesType, 19);
    }
  }
};
</script>

<style lang="scss" scoped>
@import "~@/assets/scss/decorate.scss";
</style>
